package com.lmj.learnspringboot.config;

import com.lmj.learnspringboot.interceptor.MethodParamInterceptor;
import org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author: lmj
 * @version: MethodParamLogConfig.java lmj v1.0 2021/11/14 00:46
 */
@Configuration
public class MethodParamLogConfig {

    @Bean
    public MethodParamInterceptor methodParamInterceptor() {
        return new MethodParamInterceptor();
    }

    @Bean
    public BeanNameAutoProxyCreator beanNameAutoProxyCreator() {
        BeanNameAutoProxyCreator beanNameAutoProxyCreator = new BeanNameAutoProxyCreator();
        beanNameAutoProxyCreator.setBeanNames("userService*");
        beanNameAutoProxyCreator.setInterceptorNames("methodParamInterceptor");
        return beanNameAutoProxyCreator;
    }

}
